package com.study.java.junit;

import java.util.Date;

import org.junit.Test;

import com.study.java.dao.UserDao;
import com.study.java.dao.impl.UserDaoImpl;
import com.study.java.domain.User;

/**
* @Name: UserDaoTest
* @Description: UserDao层测试类
* @Author: XXX
* @CreateDate: XXX
* @Version: V1.0
 */
public class UserDaoTest {
	
	private UserDao userDao = new UserDaoImpl() ;
 	
	@Test
	public void testGetUserByUsername() {
		String username = "admin" ;
		User user = userDao.getUserByUsername(username) ;
		System.out.println(user);
	}
	
	@Test
	public void testGetUserByUsernameAndPassword() {
		String username = "test01" ;
		String password = "test01" ;
		User user = userDao.getUserByUsernameAndPassword(username, password) ;
		System.out.println(user);
	}
	
	@Test
	public void testAddUser() {
		User user = new User() ;
		user.setUsername("zhangsan") ;
		user.setPassword("zhangsan") ;
		user.setBirthday(new Date()) ;
		user.setEmail("123@123.com") ;
		userDao.addUser(user) ;
	}

}
